
package com.tz.tzgw.pc.web.dao;

import com.tz.tzgw.pc.web.model.Role;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class RoleDao {
    private final JdbcTemplate jdbcTemplate;

    public RoleDao(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public Role getRoleById(Long role_id) {
        String sql = "SELECT * FROM tz_role WHERE id = ?";
        return jdbcTemplate.queryForObject(sql, new Object[]{role_id}, new BeanPropertyRowMapper<>(Role.class));
    }
}
